using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using WebFoundation.Data;
using MHI.InspectionManager.Interfaces; 

namespace MHI.InspectionManager.Data
{
	/// <summary>
	/// DevPlandeviceT,table items:dev_plandevice_t 
	/// </summary>
	internal class DevPlandeviceTQueryDAO : QueriableDAO<DevPlandeviceT> 
	{
		protected static DbManager _dbManager = DbManager.FromConfig("DefaultConnection");

		public DevPlandeviceTQueryDAO()
		: base(_dbManager)
		{
		}

		public DevPlandeviceTQueryDAO(DbManager db)
		: base(db)
		{
		}

		/// <summary>
		/// 获取所有DevPlandeviceT,table items:dev_plandevice_t信息 
		/// </summary>
		/// <returns></returns>
		public IEnumerable<DevPlandeviceT> GetDevPlandeviceTAllItems()
		{
			var query = this.CreateQuery();
			query.Filter().Eq(r => r.IsUse, 1);
			return this.Query(query);
		}

		/// <summary>
		/// 根据id，获取所有DevPlandeviceT,table items:dev_plandevice_t信息 
		/// </summary>
		/// <returns></returns>
		public IEnumerable<DevPlandeviceT> GetDevPlandeviceTItemsById(int id)
		{
			var query = this.CreateQuery();
			query.Filter().Eq(r => r.Id, id);
			return this.Query(query);
		}

		/// <summary>
		/// 根据planJobId，获取所有DevPlandeviceT,table items:dev_plandevice_t信息 
		/// </summary>
		/// <returns></returns>
		public IEnumerable<DevPlandeviceT> GetDevPlandeviceTItemsByPlanJobId(int planJobId)
		{
			var query = this.CreateQuery();
			query.Filter().Eq(r => r.PlanJobId, planJobId);
			return this.Query(query);
		}

		/// <summary>
		/// 根据deviceId，获取所有DevPlandeviceT,table items:dev_plandevice_t信息 
		/// </summary>
		/// <returns></returns>
		public IEnumerable<DevPlandeviceT> GetDevPlandeviceTItemsByDeviceId(int deviceId)
		{
			var query = this.CreateQuery();
			query.Filter().Eq(r => r.DeviceId, deviceId);
			return this.Query(query);
		}

	}
}
